﻿/**
 *	@file		CCEGLViewProtocol.cpp
 *	@author		NeoZhang
 *	@version	v0.1
 *	@date		2013/09/03
 *	@brief		
 */

#include "CCEGLViewProtocol.h"

NS_CC_BEGIN

//!	构造
CCEGViewProtocol::CCEGViewProtocol()
:m_eResolutionPolicy(kResolutionUnKnown)
{
}

//!	析构
CCEGViewProtocol::~CCEGViewProtocol()
{
}

//!	获取视图框架的大小
const CCSize& CCEGViewProtocol::getFrameSize() const
{
	return m_obScreenSize;
}

//!	设置应用分辨率的大小
void CCEGViewProtocol::setFrameSize(float width, float height)
{
	m_obDesignResolutionSize = m_obScreenSize = CCSizeMake(width, height);
}

CCSize CCEGViewProtocol::getVisibleSize() const
{
	if(m_eResolutionPolicy == kResolutionNoBorder)
	{
		return CCSizeMake(m_obScreenSize.width/m_fScaleX, m_obScreenSize.height/m_fScaleY);
	}
	else
	{
		return m_obDesignResolutionSize;
	}
}

CCPoint CCEGViewProtocol::getVisibleOrgin() const
{
	if(m_eResolutionPolicy == kResolutionNoBorder)
	{
		return CCPointMake((m_obDesignResolutionSize.width - m_obScreenSize.width/m_fScaleX)/2,
						   (m_obDesignResolutionSize.height - m_obScreenSize.height/m_fScaleY)/2);
	}
	else
	{
		return CCPointZero;
	}
}
NS_CC_END